/**
 * @title
 * @description
 * @author 张玉华
 * @date 2020-11-16 14:57
 */
import {Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn} from "typeorm";
import {User} from "./User";

@Entity()
export class Family {

  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  address: string;

  @Column()
  phone: string;

  @Column()
  num: number;

  @Column()
  info: string;

  // 关系的所有者端需要使用@JoinColumn修饰器。
  @OneToOne(type => User, user => user.family)
  @JoinColumn()
  user: User;
}
